Make snapshot updates possible without modifying test code#564
Open
uzulla wants to merge 1 commit intophp-embed:masterfrom
Open
Make snapshot updates possible without modifying test code#564uzulla wants to merge 1 commit intophp-embed:masterfrom
uzulla wants to merge 1 commit intophp-embed:masterfrom
Conversation
This was referenced Nov 20, 2025
Merged
Add UPDATE_EMBED_SNAPSHOTS environment variable to update both HTTP response cache and fixtures together when running tests. Changes: - Add UPDATE_EMBED_SNAPSHOTS=1 to fetch from network and update snapshots - Add EMBED_STRICT_CACHE=1 to fail if cache is missing (for CI) - Update GitHub Actions workflow to use EMBED_STRICT_CACHE - Add comprehensive documentation for snapshot testing in README Usage: UPDATE_EMBED_SNAPSHOTS=1 ./vendor/bin/phpunit --filter testYoutube
c88c244 to
ef4df71
Compare
Contributor
Author
|
Thank you for waiting. It’s now ready for review. |
Collaborator
Very well, then I'll proceed to review |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Updating test snapshots required modifying constants inside the test suite.
This made the workflow unnecessarily awkward and error-prone:
As a result, contributors could not easily refresh snapshots, raising
the barrier for maintaining or improving tests.
This PR introduces a simple environment-based switch so contributors can
update snapshots without touching the codebase.
What
New environment variables
UPDATE_EMBED_SNAPSHOTS=1EMBED_STRICT_CACHE=1Developer workflow
Developers can now refresh snapshots with a single command:
No code edits and no numeric flags are required.
CI updates
GitHub Actions now runs with:
to ensure snapshot files are always present and up to date.
Documentation
A new "Testing" section has been added to the README, describing how
snapshots are updated and how strict mode behaves in CI.
Usage Examples
Execute result
Update success on Linux, please open details.
Details
env(docker)
Execute output
on macOS error sample
But failed on MY mac. It’s probably due to macOS resource limitations, and I could not solve fails.
But It succeeds on Linux, so I don’t think the code itself is incorrect.